Skip to content

Refactor Validation and Create RollCall module#56

Open
codedbyishika wants to merge 24 commits into
mainfrom
refactoring_validation
Open

Refactor Validation and Create RollCall module#56
codedbyishika wants to merge 24 commits into
mainfrom
refactoring_validation

Conversation

@codedbyishika

@codedbyishika codedbyishika commented Jun 3, 2026

Copy link
Copy Markdown

Move following functions from main.py to Validation.py + Change AGENTS.md:
validate_csv_extension
validate_output_directory This function was removed, as it should have been in #43.
validate_filename_uniqueness
handle_missing_filenames
setup_expected_columns

RollCall Module

Added above functionalities and check_existing_images to the rollcall module which prechecks all the conditions before downloading.

Non Interactive Missing File Handling

  • Implemented missing file check as non interactive error handing

Duplicate Checksums

  • Implemented checks for checking duplicates

Summary

  • Implemented summary of where images & downsized images will be downloaded

  • Changed main according to new csv handle
  • Updated tests to the new features

Move following functions:
validate_csv_extension
validate_output_directory
validate_filename_uniqueness
handle_missing_filenames
setup_expected_columns
@codedbyishika
codedbyishika requested a review from egrace479 June 4, 2026 17:04

@egrace479 egrace479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found a holdover from prior implementation method.

Comment thread src/cautiousrobot/validation.py Outdated
@egrace479 egrace479 changed the title Refractor Validation.py Refactor Validation.py Jun 4, 2026
Co-authored-by: Elizabeth Campolongo <38985481+egrace479@users.noreply.github.com>

This comment was marked as outdated.

Comment thread src/cautiousrobot/validation.py Outdated

This comment was marked as outdated.

This comment was marked as outdated.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread src/cautiousrobot/validation.py Outdated
Comment thread src/cautiousrobot/validation.py Outdated
@egrace479 egrace479 mentioned this pull request Jun 8, 2026
2 tasks
- Change tests
- Include check_existing_images
This reverts commit ff930b0.
@codedbyishika codedbyishika linked an issue Jun 17, 2026 that may be closed by this pull request
@codedbyishika codedbyishika changed the title Refactor Validation.py Refactor RollCall.py Jun 17, 2026
Comment thread src/cautiousrobot/roll_call.py Outdated
@codedbyishika
codedbyishika requested a review from egrace479 June 19, 2026 19:07
@codedbyishika codedbyishika changed the title Refactor RollCall.py Refactor Validation and Create RollCall module Jun 22, 2026

@egrace479 egrace479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't had a chance to check the test changes, but some efficiency can be added and I have some questions in implementation of new features that rely on consideration of the motivation. Mainly the new duplicate check that should have an option to ignore for the purposes of still downloading, but then what is the intended response to duplicates; if the ignore flag is passed, should it be skipped or at least provide the duplicates in a usable format so the user can do something with the information?

roll_call.check_duplicate_checksums(
data_df=source_df,
hash_col=args.verifier_col.lower(),
ignore_duplicates=getattr(args, "ignore_duplicates", False)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this defined?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def check_duplicate_checksums(self, data_df, hash_col, ignore_duplicates=False): """ Detect duplicate checksum values and optionally block execution.
It is defined under the RollCall module as function check_duplicate_checksums

Comment on lines 139 to +141
# Validate and handle existing output directory
img_dir = args.output_dir
source_df, filtered_df = check_existing_images(csv_path, img_dir, source_df, filename_col, subfolders)
source_df, filtered_df = roll_call.check_existing_images(csv_path, img_dir, source_df, filename_col, subfolders)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea of checking for duplicate hashes in the source DataFrame first to alert the user to their existence even if they have most images already?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the idea is to check duplicate hash values in the source DataFrame before the download step

Comment thread src/cautiousrobot/__main__.py Outdated
Comment thread src/cautiousrobot/__main__.py Outdated
Comment thread src/cautiousrobot/__main__.py Outdated
Comment thread src/cautiousrobot/roll_call.py Outdated
Comment thread src/cautiousrobot/roll_call.py Outdated
# If duplicates exist, preview or save
self._preview_or_save("duplicate_checksums", dupes)

if ignore_duplicates:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is going to run regardless of the ignore, it seems like it would make sense to print or save duplicates so the user is aware and can do something with that information.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation prints if duplicates less than or equal to 5 else saves on the disk. I have included arg pass to ignore the duplicates checksums on the disk.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's log duplicates of any number, rather than a magic threshold of 5

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the 5 value threshold.

Comment thread AGENTS.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add dry-run functionality Extract the pre-download verification elements into roll_call module.

4 participants